using System;
using UnityEngine;
using UnityEngine.UI;

public class UIManager : MonoBehaviour
{
    public static UIManager instance;

    public GameObject MessageBox;

    public GameObject PhoneMagnified;

    public GameObject EndGamePanel;

    [Header("End Game Related")] 
    public int food;
    public int rentals;
    public int SalaryPerNPC;
    public int FinesPerNPC;

    public Text txt_Food;
    public Text txt_Rentals;
    public Text txt_Salary;
    public Text txt_Fines;
    public Text txt_Balance;

    public bool isTimeToGoHome;

    private void Awake()
    {
        if (instance == null)
        {
            DontDestroyOnLoad(gameObject);
            
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
    }

    private void Start()
    {

    }

    public void WhenEnd()
    {
        EndGamePanel.SetActive(true);
        txt_Food.text = "Food: " + food;
        txt_Rentals.text = "Rentals: " + rentals;
        txt_Salary.text = "Salary: " + SalaryPerNPC * NPCManager.instance.CheckedNPCNumber;
        txt_Fines.text = "Fines: " + FinesPerNPC * NPCManager.instance.WrongDenyNPCNumber;
        txt_Balance.text = "Balance: " +
                           (SalaryPerNPC * NPCManager.instance.CheckedNPCNumber - food - rentals - FinesPerNPC * NPCManager.instance.WrongDenyNPCNumber);
    }
}
